package routers

import (
	"hello/controllers/admin"

	"hello/controllers/api"

	beego "github.com/beego/beego/v2/server/web"
)

func init() {

	beego.Router("/", &admin.MainController{})
	beego.CtrlGet("/user", admin.UserController.GetUserById)
	beego.Router("/goods", &admin.GoodsController{})
	beego.Router("/api/student", &api.StudentController{})
	beego.Router("/admin/index", &admin.IndexController{})
	beego.Router("/api/get_student", &api.StudentController{}, "get:Index")
	beego.Router("/api/get_student_by_id", &api.StudentController{}, "get:GetStudent")
	beego.Router("/api/return_json", &api.StudentController{}, "get:GetStudentJson")
	beego.Router("/api/post_data", &api.StudentController{}, "post:GetStudentJson_v2")
	beego.Router("/api/post_json", &api.StudentController{}, "post:GetStudentJson_v3")
	beego.Router("/api/get_timestamp", &api.StudentController{}, "get:Get_timestamp")
	beego.Router("/api/get_md5", &api.StudentController{}, "get:Get_md5")
	// 钩子函数
	beego.Router("/api/before_after", &api.StudentController{}, "get:BeforeAfter")

	beego.Router("/api/insert_user", &api.UserController{}, "get:Insert")
	beego.Router("/api/select_user", &api.UserController{}, "get:Select")

	// model获取一条数据
	beego.Router("/api/select_user_one", &api.UserController{}, "get:SelectOne")
	// model获取一条数据，返回json数据
	beego.Router("/api/select_user_one_json", &api.UserController{}, "get:SelectOneJson")
	beego.Router("/api/select_user_all", &api.UserController{}, "get:SelectAll")
	// model获取所有数据，返回json数据
	beego.Router("/api/select_user_all_json", &api.UserController{}, "get:SelectAllJson")
}
